package com.gaofans.vertx.boot.web.route;

import com.gaofans.vertx.boot.web.auth.AuthorityDefinition;
import io.vertx.core.Handler;
import io.vertx.core.http.HttpMethod;
import io.vertx.ext.web.RoutingContext;

/**
 * vertx web route定义
 * @author GaoFans
 */
public class RouteDefinition {

    /**
     * 路由地址
     */
    private String path = "";
    /**
     * 请求方法
     */
    private HttpMethod[] httpMethod = {};
    /**
     * 路由的优先级
     */
    private int order = 0;

    /**
     * 是否打开requestBody
     */
    private boolean requestBody;
    /**
     * 路由执行句柄
     */
    private Handler<RoutingContext> handler;

    /**
     * 需要的权限
     */
    private AuthorityDefinition authorityDefinition;

    private String[] headers = {};

    private String[] consumes = {};

    private String[] produces = {};

    private Class<? extends Handler<RoutingContext>>[] includeHandlers;

    private Class<? extends Handler<RoutingContext>>[] excludeHandlers;

    private boolean templateRender = false;

    private boolean responseBody = false;

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public HttpMethod[] getHttpMethod() {
        return httpMethod;
    }

    public void setHttpMethod(HttpMethod[] httpMethod) {
        this.httpMethod = httpMethod;
    }

    public int getOrder() {
        return order;
    }

    public void setOrder(int order) {
        this.order = order;
    }

    public boolean isRequestBody() {
        return requestBody;
    }

    public void setRequestBody(boolean requestBody) {
        this.requestBody = requestBody;
    }

    public Handler<RoutingContext> getHandler() {
        return handler;
    }

    public void setHandler(Handler<RoutingContext> handler) {
        this.handler = handler;
    }

    public AuthorityDefinition getAuthorityDefinition() {
        return authorityDefinition;
    }

    public void setAuthorityDefinition(AuthorityDefinition authorityDefinition) {
        this.authorityDefinition = authorityDefinition;
    }

    public String[] getHeaders() {
        return headers;
    }

    public void setHeaders(String[] headers) {
        this.headers = headers;
    }

    public String[] getConsumes() {
        return consumes;
    }

    public void setConsumes(String[] consumes) {
        this.consumes = consumes;
    }

    public String[] getProduces() {
        return produces;
    }

    public void setProduces(String[] produces) {
        this.produces = produces;
    }

    public Class<? extends Handler<RoutingContext>>[] getIncludeHandlers() {
        return includeHandlers;
    }

    public void setIncludeHandlers(Class<? extends Handler<RoutingContext>>[] includeHandlers) {
        this.includeHandlers = includeHandlers;
    }

    public Class<? extends Handler<RoutingContext>>[] getExcludeHandlers() {
        return excludeHandlers;
    }

    public void setExcludeHandlers(Class<? extends Handler<RoutingContext>>[] excludeHandlers) {
        this.excludeHandlers = excludeHandlers;
    }

    public boolean isTemplateRender() {
        return templateRender;
    }

    public void setTemplateRender(boolean templateRender) {
        this.templateRender = templateRender;
    }

    public boolean isResponseBody() {
        return responseBody;
    }

    public void setResponseBody(boolean responseBody) {
        this.responseBody = responseBody;
    }
}
